package student.aistar.config;

import com.alipay.easysdk.factory.Factory;
import org.springframework.stereotype.Component;
import com.alipay.easysdk.kernel.Config;
/**
 * 本类用来演示:
 *
 * @author: qinFeng
 * @date: 2021/10/22 21:53
 */
@Component
public class AlipayConfig {

    // 1. 设置参数（全局只需设置一次）
    static {
        Factory.setOptions(getOptions());
    }

    private static Config getOptions() {
        Config config = new Config();

        config.protocol = "https";

        // 沙箱环境修改为 openapi.alipaydev.com
        config.gatewayHost = "openapi.alipaydev.com";

        config.signType = "RSA2";

        config.appId = "2021000118637032";

        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCKa1o3+xAZVZMWAW9dPMvhTN86Jg/+DCz4HpGtkbn2Ck/3w+mzqtux2oNDK8fIFQIA6YSwRzpUumlAKHNKkQfRz1opOpUKqM7srFu+kJt2PVJXjm3nohVrOlYiR5wwuWEnWWBuTFgB9A6oz4H0LuWABwodfaqjLMHrbdK82PaAj2j6DNsUi4seRPhp/qYHVZLT+tx8ukRewNWHizbBfcfUxdiS0QnPLWo3WmL/9wON00t60uVWtsLMmGD2Zdy1tFU8pIhuvtjR0uQ429TLKawumskQo9xDx8W2Hcm7h7Q9YoOk4ewp+k9zhlJEM9wgaZXGjeATzSG2pRuyAVNPPzQlAgMBAAECggEAZOX0EbJ0/cKfQP8yymgyxbxfS+fK6Ii/ju3Ziwga4fqKaDTq+giltHNwE1qqenK1zyxpiIWjQ3fOmPHjeItXg9z9/+ewFOEQVP0esz591CbHCwPLoXlI26zedIZ2mB3JcAF6hWwpCuN4fB0mwXQd3sFC4lRkOiW6BX88imQs63CKomN2Xp1WMePXAryJczpMZpmzkKsGQGcbvO2VbO8t+2WzWxL+x4TU8bGLPAX8Td+mzm2VvGPXaYhmLPBx0tHCp5/tePk6ugmf0tc5Pt0cawdkp2KBnkorn4cz/ZUPI4KHWPdVim4Iv5Wswj07urHHy5wxgXKeygK6HlWzB3dTgQKBgQDOTRJ6tQJf2s5YcPN+99dQNQXEn8Gh7JUrqZpuCkrReRrYNa9wXIelD+4O7uto4oJUC/Wn7DwlTAWvbKVRl5foZG45DjlEZDxcu50qzV/NjBakuRS+9yRvOGdLDcmPHPNLc4ZJ+UIZ0yY2wo+QaOW8LwvOb7mwBAKT4RQF9nKdbQKBgQCrw+cENlxHimcfWR5LDSh6j9WX53BrgsELWpQxaa+zBDbZ3LNes7oLmQmdUtLBo5mQUZ/kQa3umwDqJCKuIArcpJUcop0CkNjRdZ51DonITHR++fTMJEFedLHpCSL43C0OKUM0mrf6ZHj956mUZ2HiIxKJLQu/ZZa9kd2gL/7WmQKBgQCcTO5kQ4HCB+/wN9tz5eienx14pCU7PhiilQQovOmEnUGGb940vhYTK+eMLt3ygDKH5OvAxw2moFtqVmFGWRlBe926opkmxN6qz4Y7KJCeFbYOJR+fs3VKQqyXw6FjKWb3UlZ68ztuf3hjYrMMkT0Ff4ttY16HCfK+AXh/MAIUXQKBgG69jhrkJVimfdfzMBm5MQjb5RzbxVo7YdS9IGA/QF0NcYPCzA5Zl7BUiaNZu7HGlYI7bffO9KGqY8uRYp6a4AXjQpPEr6/wzSk2SOQ1bFWsHUukQdS/5zlLyUxybI6//Xhs1/x5Z/ZSgsNIccfRY4VVkWTJmxJaH/a2rYnSh925AoGBAKVyIN64iep12GldMlI6kvkAkUmTctHo/p+0U3a8BJYezbn25noBB5IGjcgyFRmG6lEgrHfMzR/lTOJ+kE9qcHUicihWtaIT8dR1UGqYXceI0mLIQ2uHLYw1b3zhD2SpnekJWOeqc62u/FoNftu9W2nDLk1gH2n0iLsmwc9BW9ov";

        //注：如果采用非证书模式，则无需赋值上面的三个证书路径，改为赋值如下的支付宝公钥字符串即可
        config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAphW1mTQkeHOm9LTbMcOHvDtQKYD+E0yYc1TE5Gy73X/RhQuPsODdMIpqyEOnM7uHX3GUEXwxiJaOVinXiZMS78H3JM22R0JQlH1PHS/WnjbiEFUfEPI/9VlbThdOGB8pbFm4PecZosOc7qKYPVbtDWz4drjj3RR24hvQQ22ozyIXD0HUf4CaG5Vj9Qrslwufaln8wOaBcU+FNXvjc/t6zYOJYYJD0c4n6lyFUH1sQVSpWSWzoGgskOVnHDdB/3WNDGqtbI65j0g0d9wP0Z0wEkBOml0GwrEPxGEsmAwjlfjoU288vzMFZZLxLoGh2Z5jtQdsOCgm7IK8ohxoH0wpAQIDAQAB";

        //可设置异步通知接收服务地址（可选）（该地址需要外网能够访问）
        config.notifyUrl = "http://44u7b44003.qicp.vip/mi/pay/callback";

        return config;
    }
}
